<?php
/*
 */
session_start();
$title=$_POST['newsite'];
if(!empty ($title)){
  //include '../../../readcookie.php';
  eval($_SESSION['db']);

  $site=array();
  $result=$mysqli->query('select * from sg_sites');
  while($r=$result->fetch_row())$sites[$r[0]]=$r[1];
  $result->close();
  echo implode($sites);

  $q="insert into 'sg_sites' ('name') values ('$title');";
  mysql_query($q) or die('While trying to add '.$title.'<br/>Error, insert query failed: '.$mysqli->error);
  $mysqli->close();
}
echo'
<script type="text/javascript">
window.location.href = document.referrer;
</script>
';

?>

